package ouc.tl.ISAP;


import java.util.ArrayList;
import java.util.HashMap;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.AdapterView.OnItemClickListener;

public class JWSNews extends BSActivity {
	Button BackHome =null;
	/** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.jwcnews);
        BackHome=(Button)findViewById(R.id.jwcButton);
        BackHome.setOnClickListener(listener);
        ListView newslist=(ListView)findViewById(R.id.newstitle);
        ArrayList<HashMap<String,Object>> listItem= new ArrayList<HashMap<String,Object>>();
        for(int i=0;i<30;i++){
        	HashMap<String,Object> map=new HashMap<String,Object>();
        	map.put("newtitle",i);
        	listItem.add(map);
        }
        SimpleAdapter listItemAdapter = new SimpleAdapter(this,listItem,
                R.layout.newslistitem,        
                new String[] {"newtitle"},    
                
                new int[] {R.id.newtitle}   
                );
                newslist.setAdapter(listItemAdapter);
                newslist.setOnItemClickListener(new OnItemClickListener() {   

        		public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
        				long arg3) {
        			Intent intent=new Intent();
        			intent.setClass(JWSNews.this,News.class);
        			startActivity(intent);
        			
        		}   
                });
    }
    private OnClickListener listener = new OnClickListener()
    {

		public void onClick(View v) {
			switch(v.getId())
			{
			case R.id.jwcButton:
				JWSNews.this.finish();
			}
			
		}
    	
    	
    };
}

